icontheme: fill correct information when loading GResource-backed GIcons
authorCosimo Cecchi <cosimoc@gnome.org>
Mon, 23 Feb 2015 01:49:55 +0000 (17:49 -0800)
committerCosimo Cecchi <cosimoc@gnome.org>
Mon, 23 Feb 2015 17:56:06 +0000 (09:56 -0800)
When loading a GResource-backed GFileIcon into a GtkIconInfo we
currently fail to populate the is_resource private field.
Also, since is_svg is set by looking at the filename, and
g_file_get_path() returns NULL for a GResourceFile, is_svg was always
FALSE.

https://bugzilla.gnome.org/show_bug.cgi?id=744991

gtk/gtkicontheme.c

index dc82b4501ca298045da4fc3c427f6ed2a7c8d5dd..2f45f63ce1270b53dbfe7333ce4fd7ccdc80d2ad 100644 (file)
@@ -5451,7 +5451,21 @@ gtk_icon_theme_lookup_by_gicon_for_scale (GtkIconTheme       *icon_theme,
           if (file != NULL)
             {
               info->icon_file = g_object_ref (file);
-              info->filename = g_file_get_path (file);
+              info->is_resource = g_file_has_uri_scheme (file, "resource");
+
+              if (info->is_resource)
+                {
+                  gchar *uri;
+
+                  uri = g_file_get_uri (file);
+                  info->filename = g_strdup (uri + 11); /* resource:// */
+                  g_free (uri);
+                }
+              else
+                {
+                  info->filename = g_file_get_path (file);
+                }
+
               info->is_svg = suffix_from_name (info->filename) == ICON_SUFFIX_SVG;
             }
         }